﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Web.Core;
using Web.Core.Objects;

public partial class include_left_menu : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Category.DataSource = Manufacturers.GetAllManufacturers();// Categories.GetCategories((int)Session["Language"]);
        Category.DataBind();

        this.product_pro.DataSource = Products.GetProductsPromotion(10, int.Parse(Session["Language"].ToString()));
        this.product_pro.DataBind();
    }
    public string getChild(int parent_id)
    {
        string str =null;
        ArrayList childs = new ArrayList();
        childs = Categories.GetChild(parent_id,(int)Session["Language"]);
        str = "<dd class='accordion1_content_1'><dl>";
        foreach (Category item in childs)
        {
            str += "<dt class='no_sub'>";
            str += "<a href='?act=category&catid="+item.Id+"'>" + item.Name + "</a></dt>";								
        }
        str += "</dl></dd>";
        return str;
    }

    public string getCategory(int manuID)
    {
        ArrayList list = new ArrayList();
        list = Categories.getByManu(manuID, (int)Session["Language"]);
        string str= "";
        foreach (Category item in list)
        {
            str +="<div class='jamod-content ja-box-ct clearfix'><dl class='accordion'>";
			str +="<dt id='accordion1_toggler_12' class='accordion1_toggler_1' style='background-color: #FFFFFF;'>";											
			str +=" <a href='?act=category&catid="+item.Id+"'>"+item.Name+"</a></dt>";											
			str += this.getChild(item.Id);											   
			str += "<dd style='display: none;' class='accordion1_content_1'></dd></dl></div>";																				
        }

        return str;
    }
}
